package com.ai.nsa.utils.hbase;

import com.ai.nsa.utils.pool.ConnectionPool;
import com.ai.nsa.utils.pool.PoolBase;
import com.ai.nsa.utils.pool.PoolConfig;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.client.Connection;

/**
 * @author Feng Chen 2017/6/7.
 */
public class HBasePool extends PoolBase<Connection> implements ConnectionPool<Connection> {

    public HBasePool() {

    }

    public HBasePool(final Configuration configuration) {
        this(new PoolConfig(), configuration);
    }

    public HBasePool(final PoolConfig poolConfig) {
        super(poolConfig, new HBaseFactory());
    }

    public HBasePool(final PoolConfig poolConfig, final Configuration configuration) {
        super(poolConfig, new HBaseFactory(configuration));
    }

    @Override
    public Connection borrowConnection() {
        return super.borrowResource();
    }

    @Override
    public void returnConnection(Connection conn) {
        super.returnResource(conn);
    }

    @Override
    public void invalidateConnection(Connection conn) {
        super.invalidateResource(conn);
    }
}
